package com.ruoyi.web.controller.client;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.vo.MessageVo;
import com.ruoyi.system.service.MessageService;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

/**
 * @author Yuan
 * @description
 * @date 2023/12/5
 */
@RestController
@RequestMapping("/client")
@RequiredArgsConstructor
public class CustomController {
    private static final Logger log = LoggerFactory.getLogger(CustomController.class);
    private final MessageService messageService;

    //客户评价
    @PostMapping("/feedBack")
    public void feedBack(@RequestParam("carId") String carId, @RequestBody MessageVo messageVo)
    {
        messageService.feedBack(carId, messageVo);
    }

    //获取评论数据
    @GetMapping("/getEvaluationData")
    public AjaxResult getEvaluationData(String carId, Long index)
    {
        if(index == null) {
            index = -1L;
        }
        return messageService.getMessages(carId, index);
    }
}
